package cn.lingyangwl.agile.food.model.rqrs.sku;

import cn.lingyangwl.agile.model.constants.ValidationCons;
import cn.lingyangwl.agile.food.model.entity.GoodsSku;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;

/**
 * 商品sku
 *
 * @author shenguangyang
 */
@Getter
@Setter
public class SkuBase {
    @NotNull(message = ValidationCons.NOT_EMPTY)
    @ApiModelProperty(value = "商品id")
    private Long goodsId;

    @NotEmpty(message = ValidationCons.NOT_EMPTY)
    @ApiModelProperty(value = "sku编号")
    private String skuCode;

    @NotNull(message = ValidationCons.NOT_EMPTY)
    @ApiModelProperty(value = "价格")
    private BigDecimal price;

    @ApiModelProperty(value = "成本价钱")
    private BigDecimal costPrice;

    @NotNull(message = ValidationCons.NOT_EMPTY)
    @ApiModelProperty(value = "库存")
    private List<Stock> stockList;

    @ApiModelProperty(value = "销量")
    private Integer saleNumber;

    @ApiModelProperty(value = "商品销售规格，json格式")
    private List<GoodsSku.Spec> specData;

    @NotNull(message = ValidationCons.NOT_EMPTY)
    @ApiModelProperty(value = "锁定库存")
    private Integer lockStock;

    @ApiModelProperty(value = "商品重量, 默认为kg")
    private BigDecimal weight;

    @Data
    public static class Stock {
        private String storeId;
        private Integer stock;
    }
}
